<?php

namespace aerovuelos\ReservaBundle\Form;

use Symfony\Component\Form\AbstractType;
use Symfony\Component\Form\FormBuilderInterface;
use Symfony\Component\OptionsResolver\OptionsResolverInterface;

class ReservasXPersonasType extends AbstractType {

    public function buildForm(FormBuilderInterface $builder, array $options) {

        $builder->add('personas', new \aerovuelos\PersonaBundle\Form\PersonasType());
        $builder
                ->add('asiento', 'choice', array(
                    'choices' => array(
                        '1' => '1',
                        '2' => '2',
                        '3' => '3',
                        '4' => '4',
                        '5' => '5',
                        '6' => '6'
                    ),
                    'empty_value' => 'Seleccionar...',
                    'empty_data' => null,
                    'required' => true,
                    'mapped' => false,
                    'attr' => array('class' => 'asiento')
                ))
        ;
    }

    public function setDefaultOptions(OptionsResolverInterface $resolver) {
        $resolver->setDefaults(array(
            'data_class' => 'aerovuelos\ReservaBundle\Entity\ReservasXPersonas',
            'cascade_validation' => true
        ));
    }

    public function getName() {
        return 'aerovuelos_reservabundle_reservasxpersonastype';
    }

}
